package org.agony2d.view.puppet 
{
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.utils.getDefinitionByName;
	import org.agony2d.debug.Logger;
	import org.agony2d.renderer.display.DisplayUtil;
	import org.agony2d.renderer.IView;
	import org.agony2d.view.core.Component;
	import org.agony2d.view.core.ComponentProxy;
	import org.agony2d.view.Fusion;
	import org.agony2d.view.puppet.supportClasses.PuppetComp;
	
	import org.agony2d.core.agony_internal;
	use namespace agony_internal;
	
	/** 显示对象容器傀儡
	 *  [◆]
	 * 		1. numChildren
	 *  [◆◆]
	 * 		1. addChild
	 * 		2. removeChild
	 * 		3. contains
	 * 		4. addChildAt
	 * 		5. removeChildAt
	 * 		6. getChildAt
	 * 		7. getChildByName
	 * 		8. getChildIndex
	 * 		9. setChildIndex
	 */
public class DisplayObjectContainerPuppet extends ComponentProxy
{
	
	public function DisplayObjectContainerPuppet() 
	{
		m_view = PuppetComp.getPuppetComp(this)
	}
	
	final public function get numChildren() : int { return m_view.numChildren }
	
	final public function addChild( child:DisplayObject ) : DisplayObject
	{
		return m_view.addChild(child)
	}
	
	final public function removeChild( child:DisplayObject ) : DisplayObject
	{
		return m_view.removeChild(child)
	}
	
	final public function addChildAt ( child:DisplayObject, index:int) : DisplayObject
	{
		return m_view.addChildAt(child, index)
	}
	
	final public function contains( child:DisplayObject ) : Boolean
	{
		return m_view.contains(child)
	}
	
	final public function removeChildAt ( child:DisplayObject, index:int) : DisplayObject
	{
		return m_view.removeChildAt(index)
	}
	
	final public function getChildAt ( index:int) : DisplayObject
	{
		return m_view.getChildAt(index)
	}
	
	final public function getChildByName( name:String ) : DisplayObject
	{
		return m_view.getChildByName(name)
	}
	
	final public function getChildIndex( child:DisplayObject ) : int
	{
		return m_view.getChildIndex(child)
	}
	
	final public function setChildIndex( child:DisplayObject, index:int ) : void
	{
		m_view.setChildIndex(child, index)
	}
	
	final override agony_internal function get view() : Component { return m_view }
	
	final override agony_internal function get shell() : DisplayObject { return m_view }
	
	override agony_internal function dispose() : void
	{
		DisplayUtil.clear(m_view)
		super.dispose();
	}
	
	agony_internal var m_view:PuppetComp
}
}